package com.example.demo.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean<RequestBeforeFilter> beforeFilter() {
        FilterRegistrationBean<RequestBeforeFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new RequestBeforeFilter());
        registrationBean.addUrlPatterns("/*"); // 过滤所有请求
        return registrationBean;
    }
}
